package com.cuckoo.mall.thus.menuindex.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bgn.baseframe.utils.UiUtil;
import com.bgn.baseframe.utils.imageloader.ImageLoader;
import com.cuckoo.mall.R;
import com.cuckoo.mall.javabean.ImageItem;
import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.adapter.LoopPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 伦哥哥 on 2017/6/25.
 */

public class TopBannerAdapter extends LoopPagerAdapter {
    private List<ImageItem> data = new ArrayList<>();
    private Context context;

    public TopBannerAdapter(List<ImageItem> images, Context activity, RollPagerView viewPager) {
        super(viewPager);
        data = images;
        context = activity;
    }


    @Override
    public View getView(ViewGroup viewGroup, int position) {

        View view = UiUtil.inflate(R.layout.headview_item);
        ImageView iv_lunbo_item = view.findViewById(R.id.iv_lunbo_item);
        ImageLoader.load(data.get(position).getImageUrl()).into(iv_lunbo_item);
        return view;
    }


    @Override
    public int getRealCount() {
        return data.size();
    }


}
